package com.drug.controller;

import com.drug.controller.LoginInterceptor;
import com.drug.controller.UserController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

@Configuration

public class WebConfig implements WebMvcConfigurer {

    @Autowired
    UserController userController;
    @Autowired
    LoginInterceptor loginInterceptor;
/*
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //添加对用户是否登录的拦截器，并添加过滤项、排除项
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**")
               //.excludePathPatterns("/static//**")//排除样式、脚本、图片等资源文件
               .excludePathPatterns("/static/css/**","/static/js/**","/static/img/**","/static/images/**","/static/fonts/**","/static/plugins/**")//排除样式、脚本、图片等资源文件
                .excludePathPatterns("/static/login.html")//排除登录页面
                .excludePathPatterns("/static/register.html")//排除注册页面
                .excludePathPatterns("/static/checkCode")//排除验证码
                .excludePathPatterns("/login");//排除用户点击登录按钮


    }*/
}
